package com.wlz.util;

import com.alibaba.fastjson.JSONObject;
import com.wlz.entity.response.CompleteResponse;
import com.wlz.entity.response.PartResponse;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author wlz
 * @date 2023-03-09  11:01
 */
public class CheckDataUtils {

    public static void main(String[] args) {
        String carBatchName = "N50AB-000";
        List<PartResponse> partCollection = JSONObject.parseArray(getCarBatchData(), PartResponse.class);
        List<CompleteResponse> completeResponses = JSONObject.parseArray(getCompleteCodeData(), CompleteResponse.class);
        Map<String, String> partMap = partCollection.stream().collect(
                Collectors.toMap(PartResponse::getControllerCode, PartResponse::getPartName, (key1, key2) -> key1)
        );
        for (CompleteResponse completeResponse : completeResponses) {
            String completeCode = completeResponse.getCompleteCode();
            for (PartResponse partResponse : completeResponse.getPartList()) {
                if (!partMap.containsKey(partResponse.getControllerCode())) {
                    System.out.println("项目代号下:" + carBatchName +
                            "整编零部件下: " + completeCode + "零部件： " + partResponse.getControllerCode()+ "不在项目代号下");
                }
            }
        }
    }


    public static String getCompleteCodeData() {
        return "[\n" +
                "    {\n" +
                "        \"completeCode\": \"750APB3W5017\",\n" +
                "        \"partList\": [\n" +
                "            {\n" +
                "                \"partCode\": \"ES004398\",\n" +
                "                \"partName\": \"电子制动集成模块软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00138218\",\n" +
                "                \"partName\": \"管柱开关组\",\n" +
                "                \"controllerCode\": \"CIM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127223\",\n" +
                "                \"partName\": \"手机无线充电控制器\",\n" +
                "                \"controllerCode\": \"PWC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00117805\",\n" +
                "                \"partName\": \"安全气囊控制器\",\n" +
                "                \"controllerCode\": \"SDM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200105\",\n" +
                "                \"partName\": \"PDCU 标定软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004340\",\n" +
                "                \"partName\": \"车窗防夹控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004382\",\n" +
                "                \"partName\": \"主控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114854\",\n" +
                "                \"partName\": \"左前组合灯总成\",\n" +
                "                \"controllerCode\": \"FBM-L\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114855\",\n" +
                "                \"partName\": \"右前组合灯总成\",\n" +
                "                \"controllerCode\": \"FBM-R\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114866\",\n" +
                "                \"partName\": \"右后组合灯固定部分总成\",\n" +
                "                \"controllerCode\": \"RBM_R\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114865\",\n" +
                "                \"partName\": \"左后组合灯固定部分总成\",\n" +
                "                \"controllerCode\": \"RBM_L\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114867\",\n" +
                "                \"partName\": \"中部后组合灯总成\",\n" +
                "                \"controllerCode\": \"RBM_M\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES002326\",\n" +
                "                \"partName\": \"P档控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004302\",\n" +
                "                \"partName\": \"高压电力集成单元软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES003274\",\n" +
                "                \"partName\": \"5G 智能远程控制终端软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127443\",\n" +
                "                \"partName\": \"方向盘开关总成\",\n" +
                "                \"controllerCode\": \"MFS\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004430\",\n" +
                "                \"partName\": \"车身控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004542\",\n" +
                "                \"partName\": \"座椅记忆控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004278\",\n" +
                "                \"partName\": \"集成座舱控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004342\",\n" +
                "                \"partName\": \"空调控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES001948\",\n" +
                "                \"partName\": \"电动助力转向机总成软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES001185\",\n" +
                "                \"partName\": \"胎压监测接收器软件版本号\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125785\",\n" +
                "                \"partName\": \"车桩互联模块\",\n" +
                "                \"controllerCode\": \"VCIM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127659\",\n" +
                "                \"partName\": \"氛围灯控制器\",\n" +
                "                \"controllerCode\": \"SLC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00128330\",\n" +
                "                \"partName\": \"不停车收费系统-车载电子单元总成\",\n" +
                "                \"controllerCode\": \"ETC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200129\",\n" +
                "                \"partName\": \"电机控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES003350\",\n" +
                "                \"partName\": \"无钥匙进入及启动控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            }\n" +
                "        ]\n" +
                "    }\n" +
                "]";
    }

    public static String getCarBatchData() {
        return "[\n" +
                "            {\n" +
                "                \"partCode\": \"E00110383\",\n" +
                "                \"partName\": \"空调控制器总成\",\n" +
                "                \"controllerCode\": \"ECC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114373\",\n" +
                "                \"partName\": \"抬头显示控制器总成\",\n" +
                "                \"controllerCode\": \"HUD\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114854\",\n" +
                "                \"partName\": \"左前组合灯总成\",\n" +
                "                \"controllerCode\": \"FBM-L\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114855\",\n" +
                "                \"partName\": \"右前组合灯总成\",\n" +
                "                \"controllerCode\": \"FBM-R\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114865\",\n" +
                "                \"partName\": \"左后组合灯固定部分总成\",\n" +
                "                \"controllerCode\": \"RBM_L\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114866\",\n" +
                "                \"partName\": \"右后组合灯固定部分总成\",\n" +
                "                \"controllerCode\": \"RBM_R\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00114867\",\n" +
                "                \"partName\": \"中部后组合灯总成\",\n" +
                "                \"controllerCode\": \"RBM_M\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00117805\",\n" +
                "                \"partName\": \"安全气囊控制器\",\n" +
                "                \"controllerCode\": \"SDM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00121228\",\n" +
                "                \"partName\": \"电动助力转向机总成\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00121267\",\n" +
                "                \"partName\": \"电子制动集成模块\",\n" +
                "                \"controllerCode\": \"PBM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00121268\",\n" +
                "                \"partName\": \"电子制动辅助模块\",\n" +
                "                \"controllerCode\": \"SBM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00121905\",\n" +
                "                \"partName\": \"集成座舱控制器\",\n" +
                "                \"controllerCode\": \"ICC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00122724\",\n" +
                "                \"partName\": \"智能远程控制终端\",\n" +
                "                \"controllerCode\": \"TBOX\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00124396\",\n" +
                "                \"partName\": \"智能驾驶控制器总成\",\n" +
                "                \"controllerCode\": \"ADCU\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125749\",\n" +
                "                \"partName\": \"整车数据中心\",\n" +
                "                \"controllerCode\": \"VDC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125750\",\n" +
                "                \"partName\": \"车身左区域网关控制器\",\n" +
                "                \"controllerCode\": \"VIU-ML\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125751\",\n" +
                "                \"partName\": \"车身右区域网关控制器\",\n" +
                "                \"controllerCode\": \"VIU-MR\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125780\",\n" +
                "                \"partName\": \"前舱区域网关控制器\",\n" +
                "                \"controllerCode\": \"VIU-F\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125781\",\n" +
                "                \"partName\": \"后舱区域网关控制器\",\n" +
                "                \"controllerCode\": \"VIU-R\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125783\",\n" +
                "                \"partName\": \"P挡控制器\",\n" +
                "                \"controllerCode\": \"PCU\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00125785\",\n" +
                "                \"partName\": \"车桩互联模块\",\n" +
                "                \"controllerCode\": \"VCIM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00126101\",\n" +
                "                \"partName\": \"直流充电升压器\",\n" +
                "                \"controllerCode\": \"DCB\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00126102\",\n" +
                "                \"partName\": \"高压电力集成单元\",\n" +
                "                \"controllerCode\": \"PDU\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00126602\",\n" +
                "                \"partName\": \"电池管理系统\",\n" +
                "                \"controllerCode\": \"BMS\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127223\",\n" +
                "                \"partName\": \"手机无线充电控制器\",\n" +
                "                \"controllerCode\": \"PWC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127241\",\n" +
                "                \"partName\": \"电源冗余分断器\",\n" +
                "                \"controllerCode\": \"HNS\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127396\",\n" +
                "                \"partName\": \"手机钥匙控制器\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127443\",\n" +
                "                \"partName\": \"方向盘开关总成\",\n" +
                "                \"controllerCode\": \"MFS\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127659\",\n" +
                "                \"partName\": \"氛围灯控制器\",\n" +
                "                \"controllerCode\": \"SLC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00127675\",\n" +
                "                \"partName\": \"车窗防夹控制器\",\n" +
                "                \"controllerCode\": \"APM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00128330\",\n" +
                "                \"partName\": \"不停车收费系统-车载电子单元总成\",\n" +
                "                \"controllerCode\": \"ETC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00129275\",\n" +
                "                \"partName\": \"生命体征检测系统\",\n" +
                "                \"controllerCode\": \"CPD\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00132450\",\n" +
                "                \"partName\": \"电动压缩机总成\",\n" +
                "                \"controllerCode\": \"EAS\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00132451\",\n" +
                "                \"partName\": \"水暖式电加热器\",\n" +
                "                \"controllerCode\": \"WTC\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E00138218\",\n" +
                "                \"partName\": \"管柱开关组\",\n" +
                "                \"controllerCode\": \"CIM\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200089\",\n" +
                "                \"partName\": \"MCU标定数据-中压\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200090\",\n" +
                "                \"partName\": \"MCU标定数据-高压\",\n" +
                "                \"controllerCode\": \"MCU\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200104\",\n" +
                "                \"partName\": \"PDCU标定软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200105\",\n" +
                "                \"partName\": \"PDCU 标定软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200128\",\n" +
                "                \"partName\": \"电机控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"E94200129\",\n" +
                "                \"partName\": \"电机控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES001185\",\n" +
                "                \"partName\": \"胎压监测接收器软件版本号\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES001948\",\n" +
                "                \"partName\": \"电动助力转向机总成软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES002210\",\n" +
                "                \"partName\": \"PDU软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES002326\",\n" +
                "                \"partName\": \"P档控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES003274\",\n" +
                "                \"partName\": \"5G 智能远程控制终端软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES003350\",\n" +
                "                \"partName\": \"无钥匙进入及启动控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004278\",\n" +
                "                \"partName\": \"集成座舱控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004302\",\n" +
                "                \"partName\": \"高压电力集成单元软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004340\",\n" +
                "                \"partName\": \"车窗防夹控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004342\",\n" +
                "                \"partName\": \"空调控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004376\",\n" +
                "                \"partName\": \"主控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004382\",\n" +
                "                \"partName\": \"主控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004398\",\n" +
                "                \"partName\": \"电子制动集成模块软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004430\",\n" +
                "                \"partName\": \"车身控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            },\n" +
                "            {\n" +
                "                \"partCode\": \"ES004542\",\n" +
                "                \"partName\": \"座椅记忆控制器软件\",\n" +
                "                \"controllerCode\": null\n" +
                "            }\n" +
                "        ]";
    }
}
